from rest_framework.routers import DefaultRouter


class CustomRouter(DefaultRouter):

    def register(self, prefix, viewset, basename=None):
        if basename:
            _basename = basename
        else:
            _basename = '.'.join(prefix.split('/'))
        return super().register(prefix, viewset, _basename)
